const microAppConfig = {
    development: {
        vueApp: 'http://localhost:8081',
        partyApp: 'http://localhost:8082',
    },
    staging: {
        vueApp: 'http://47.98.199.244:9901/national-examination-ai/',
        partyApp: 'http://47.98.199.244:9901/party-building/',
    },
    production: {
        vueApp: 'http://ai.whitest.com:9901/national-examination-ai/',
        partyApp: 'http://ai.whitest.com:9901/party-building/',
    }
}

export const getMicroAppConfig = () => {
    // 使用 VITE_APP_ENV 环境变量来判断当前环境
    const env = import.meta.env.VITE_APP_ENV || 'development'
    console.log('Current environment:', env);
    return microAppConfig[env] || microAppConfig.development
}

export const getMicroAppUrl = (appName) => {
    const config = getMicroAppConfig()
    const url = config[appName] || ''
    console.log(`Micro app ${appName} URL:`, url);
    return url
}

export default {
    getMicroAppConfig,
    getMicroAppUrl
}
